
const fs = require('fs');
const uuid4 = require('uuid/v4');


module.exports = {
    getName:getName,
    readFile:readFile,
    writeFile:writeFile

}

function getName(fileData){
    var type = fileData.type.split('/')[1];
    var poster = uuid4() + '.' + type;
    return  poster;
}

function readFile(filePath,callback){
        fs.readFile(filePath,function(error,data){
        callback(error,data);

    });
}

function writeFile(desPath,data,callback){
    fs.writeFile(desPath, data, function(error) {
        callback(error);
    });
}